import 'package:mziot/app/config/api.dart';
import 'package:mziot/app/data/circle_detail_entity.dart';
import 'package:mziot/app/data/circle_list_entity.dart';
import 'package:mziot/app/data/comment_list_entity.dart';
import 'package:mziot/app/data/public_model.dart';
import 'package:mziot/app/tools/public_provider.dart';

class CircleProvider {
  //获取列表
  Future<BaseModel<CircleListEntity>> takeCircleList(int page) {
    return PublicProvider.request<CircleListEntity>(
        path: Api.circleList, params: {'currentNum': page});
  }

  //获取详情
  Future<BaseModel<CircleDetailEntity>> takeCircleDetail(int id) {
    return PublicProvider.request<CircleDetailEntity>(
        path: Api.circleDetail, params: {'articleId': id});
  }

  //获取评论列表
  Future<BaseModel<CommentListEntity>> takeCircleCommentList(int page, int id) {
    return PublicProvider.request<CommentListEntity>(
        path: Api.circleCommentList, params: {'currentPage': page, 'articleId': id});
  }

  //点赞
  Future<BaseModel<dynamic>> takeCircleAgree(int id) {
    return PublicProvider.request<dynamic>(path: Api.circleAgree, params: {'articleId': id});
  }

  //评论
  Future<BaseModel<dynamic>> takeCircleComment(String text, int id) {
    return PublicProvider.request<dynamic>(
        path: Api.circleComment, params: {'content': text, 'articleId': id});
  }
}
